<?php

require_once(WSB_MODULES_PATH . 'sherpa/models/DbTable/Store/Rowset.php');
require_once(WSB_MODULES_PATH . 'sherpa/models/DbTable/Store/Row.php');

/**
 * Sherpa_Model_DbTable_Color
 *
 * PHP version 5
 *
 * @copyright  2007 Zephir Software Design AG
 */
class Sherpa_Model_DbTable_Store extends WSB_Db_Table
{

    protected $_name = 'sherpa_stores';
    protected $_primary = 'id';
    protected $_rowsetClass = 'Sherpa_Model_DbTable_Store_Rowset';
    protected $_rowClass = 'Sherpa_Model_DbTable_Store_Row';

	protected $_order = 'id ASC';
	protected $_listcols = array('id', 'name', 'zip', 'city', 'country', 'lat', 'lng');

    /**
     * 
     */
    public function getOptionsGroupedByType()
    {
        $select = $this->select();
        $select->where('deleted=?', 0);
        $select->where('hidden=?', 0);
        $select->order('type ASC');
        $options = array();
        foreach($this->fetchAll($select) AS $store) {
            $options[$store->type][$store->id] = $store->listTitle;
        }
        return $options;
    }
    
}
